#include <allegro5/allegro.h>
#include <allegro5/allegro_audio.h>

#include "Snd.h"

Snd LoadSnd(const char* name)
{
	return al_load_sample(name);
}

Blip PlaySnd(Snd sound, float volume, bool loop, float pan, float speed)
{
	ALLEGRO_SAMPLE_ID blip;
	al_play_sample((ALLEGRO_SAMPLE*)sound, 1.0, pan, speed, loop?ALLEGRO_PLAYMODE_LOOP:ALLEGRO_PLAYMODE_ONCE, &blip);
	return *(Blip*)&blip;
}

void UnloadSnd(Snd sound)
{
	al_destroy_sample((ALLEGRO_SAMPLE*)sound);
}

void StopBlip(Blip blip)
{
	al_stop_sample((ALLEGRO_SAMPLE_ID*)&blip);
}

void StopAllBlips()
{
	al_stop_samples();
}